package com.lfy.fyadmin.dto;

import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * 菜单树形节点DTO
 */
@Data
@Schema(description = "菜单树形节点")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class MenuTreeNode {
    
    @Schema(description = "权限ID")
    private Long id;
    
    @Schema(description = "权限名称")
    private String name;
    
    @Schema(description = "权限编码")
    private String code;
    
    @Schema(description = "权限类型(1:菜单,2:按钮,3:API)")
    private Integer type;
    
    @Schema(description = "父权限ID")
    private Long parentId;
    
    @Schema(description = "菜单路径")
    private String path;
    
    @Schema(description = "图标")
    private String icon;
    
    @Schema(description = "排序")
    private Integer sort;
    
    @Schema(description = "状态(0:禁用,1:正常)")
    private Integer status;
    
    @Schema(description = "子菜单列表")
    private List<MenuTreeNode> children;
    
    @Schema(description = "是否有子节点")
    private Boolean hasChildren;
    
    @Schema(description = "层级深度(从0开始)")
    private Integer level;
    
    @Schema(description = "是否为叶子节点")
    private Boolean isLeaf;
    
    @Schema(description = "完整路径(从根节点到当前节点)")
    private String fullPath;
    
    @Schema(description = "父节点路径")
    private String parentPath;
    
    /**
     * 构造函数，初始化children为空列表
     */
    public MenuTreeNode() {
        this.children = new ArrayList<>();
        this.hasChildren = false;
        this.isLeaf = true;
        this.level = 0;
    }
}